<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <a href="#">Admin</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">Service</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">Print</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">Module Template</a>
        </li>
    </ul>
</div>
<div class="container-fluid" style="margin:15px">
    <div class="row">
        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold"> Module Template </span>
                </div>
            </div>
            <div class="portlet-body form form-horizontal">
                <form novalidate name="mtForm">
                    <div class="row form-group">
                        <div class="col-md-4">
                            <label class="bold">Module</label>
                            <ui-select name="mt.module" ng-model="mt.module">
                                <ui-select-match allow-clear="true">
                                    <div ng-bind="$select.selected"></div>
                                </ui-select-match>
                                <ui-select-choices
                                        repeat="item in modules">
                                    <div ng-bind="item"></div>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                        <div class="col-md-4">
                            <label>Template:</label>
                            <div class="input-icon right"
                                 ng-show="mtForm.templateName.$invalid && (mtForm.$submitted || mtForm.templateName.$touched)">
                                <i class="fa fa-warning tooltips lt-tooltip has-error">
                                    <span class="lt-tooltip-text">Required</span>
                                </i>
                            </div>
                            <template-auto-complete ng-model="mt.templateId" name="template"></template-auto-complete>
                        </div>
                        <div class="col-md-4">
                            <label class="bold">Template Type</label>
                            <ui-select name="mt.type" ng-model="mt.type">
                                <ui-select-match allow-clear="true">
                                    <div ng-bind="$select.selected"></div>
                                </ui-select-match>
                                <ui-select-choices repeat="item in ['PDF', 'ZPL']">
                                    <div ng-bind="item"></div>
                                </ui-select-choices>
                            </ui-select>
                        </div>
                        <div class="col-md-12">
                            <label>Description:</label>
                            <input type="text" name="description" class="form-control" ng-model="mt.description"
                                   required>
                        </div>
                    </div>
                    <div class="row form-actions right">
                        <waitting-btn type="submit" btn-class="btn blue" ng-click="mtForm.$valid && submit()"
                                      permission-check="{{'service::print_write'}}"
                                      value="'submit'" is-loading="loading"></waitting-btn>
                        <button type="reset" class="btn blue" ng-click="reset()">Reset</button>
                    </div>
                </form>
                <div class="panel non-border non-gutter bottom">
                    <div class="panel-heading header-primary">
                        <h3 class="panel-title">Module Template Results
                            <input type="text" ng-model="searchText" class="form-control input-circle"
                                   placeholder="Enter text">
                        </h3>
                    </div>
                    <div class="panel-body non-gutter bottom">
                        <div>
                            <table class="table table-hover">
                                <thead>
                                <tr>
                                    <th>Module Name</th>
                                    <th>Template</th>
                                    <th>Template Type</th>
                                    <th>Description</th>
                                    <th permission-check="{{'service::print_write'}}">Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="mt in mts | filter:searchText">
                                    <td><a ng-click="toUpdate(mt)">{{mt.module}}</a></td>
                                    <td>{{mt.templateId}}</td>
                                    <td>{{mt.type}}</td>
                                    <td>{{mt.description}}</td>
                                    <td permission-check="{{'service::print_write'}}"><a ng-click="delete(mt.id)" >delete</a></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
